package com.walker.component.utils;

import java.io.IOException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

public class JsoupUtils {
	private static final Log logger = LogFactory.getLog(JsoupUtils.class);

	public static Document getHtml(String url) {
		Document doc = null;
		try {
			doc = Jsoup.connect(url).timeout(30000).get();
		} catch (IOException e) {
//			logger.error("get url fail:[" + url + "]" + e.getMessage());
		}
		return doc;
	}
	public static String getContent(String url) {
		Document doc = null;
		try {
			doc = Jsoup.connect(url).timeout(30000).get();
		} catch (IOException e) {
//			logger.error("get url fail:[" + url + "]" + e.getMessage());
			return "";
		}
		return doc.html();
	}
	
}
